package com.cardinalsolutions.progressindicator;

import com.cardinalsolutions.circleprogressindicator.CircleProgressIndicator;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;

import org.junit.Assert;
import org.junit.Test;

/**
 * LinearInterpolatorTestCase
 *
 * @since : 2021.5.24
 */
public class CircleProgressIndicatorTestCase {
    /**
     * testGetPercent
     */
    @Test
    public void testGetPercent() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        CircleProgressIndicator circleProgressIndicator = new CircleProgressIndicator(context);
        float result = circleProgressIndicator.getPercent();
        Assert.assertNotNull(result);
        Assert.assertEquals(String.valueOf(result), "10.0");
    }

    /**
     * testVpToPx
     */
    @Test
    public void testVpToPx() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        CircleProgressIndicator circleProgressIndicator = new CircleProgressIndicator(context);
        float result = circleProgressIndicator.vpToPx(context, 100);
        Assert.assertNotNull(result);
        Assert.assertEquals(String.valueOf(result),
                (context.getResourceManager().getDeviceCapability().screenDensity / 160) * 100 + ".0");
    }

    /**
     * testGetStrokeWidth
     */
    @Test
    public void testGetStrokeWidth() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        CircleProgressIndicator circleProgressIndicator = new CircleProgressIndicator(context);
        int result = circleProgressIndicator.getStrokeWidth();
        Assert.assertNotNull(result);
        Assert.assertEquals(String.valueOf(result), "100");
    }

    /**
     * testGetDefaultColor
     */
    @Test
    public void testGetDefaultColor() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        CircleProgressIndicator circleProgressIndicator = new CircleProgressIndicator(context);
        int result = circleProgressIndicator.getDefaultColor();
        Assert.assertNotNull(result);
        Assert.assertEquals(String.valueOf(result), "452984831");
    }
}
